<template>
<div class="wrapper">
  <swiper  :options="swiperOptions" v-if="swiperList.length">
    <swiper-slide v-for="item of swiperList" :key="item.id">
      <img class="swiper-img" :src="item.imgUrl" alt="">
    </swiper-slide>
    <div class="swiper-pagination" slot="pagination"></div>
  </swiper>
  </div>
</template>

<script>
export default {
  name: 'HomeSwiper',
  props: {swiperList: Array},
  data () {
    return {
      swiperOptions: {
        pagination: '.swiper-pagination',
        loop: true,
        autoplay: 3000
      }
    }
  },
  computed: {
    showSwiper () {
      return this.swiperList.length
    }
  }
//   computed: {
//     swiper () {
//       return this.$refs.mySwiper.$swiper
//     }
//   },
//   mounted () {
//     console.log('Current Swiper instance object', this.swiper)
//     this.swiper.slideTo(3, 1000, false)
//   }
}
</script>
<style lang="stylus" scoped>
  .wrapper >>> .swiper-pagination-bullet-active
     background: #eee !important
  .wrapper >>> .swiper-pagination-bullet
     background: #fff !important
  .wrapper
     background: #eee
     width: 100%
     overflow: hidden
     height: 0
     padding-bottom: 35.5%
    .swiper-img
        width: 100%
</style>
